<template>
  <div class="granary-nav-item">
    <header>
      <i class="exit" @click="back"></i>
      <h2>{{ title }}</h2>
      <i class="collect"></i>
    </header>

    <iframe v-if="show" :src="url" frameborder="0"></iframe>

    <div v-if="!show">暂时没有内容哦~~~</div>
  </div>
</template>

<script>
export default {
  name: "GranaryNavItem", //粮仓navItem页
  data() {
    return {
      url: null,
      title: null,
      show: true
    };
  },
  mounted() {
    this.url = this.$route.params.url;

    if (this.$route.params.index == 0) {
      this.title = "LOFTER入站必看";
    } else if (this.$route.params.index == 1) {
      this.title = "粮单广场";
    } else if (this.$route.params.index == 2) {
      this.title = "原创精选";
    } else if (this.$route.params.index == 3) {
      this.title = "站内热门";
      this.show = false;
    } else if (this.$route.params.index == 4) {
      this.title = "发现标签";
      this.show = false;
    }

  },
  methods: {
    back() {
      this.$router.back(); //后退
    }
  }
};
</script>

<style lang="scss" scoped>
.granary-nav-item {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: auto;
  z-index: 100;
  background-color: rgb(255, 255, 255);

  header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 44px;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ccc;

    .exit {
      width: 15px;
      height: 15px;
      margin-left: 10px;
      background-image: url("~@/assets/images/home/icon_back.png");
      background-repeat: no-repeat;
      background-position: center center;
      background-size: contain;
    }

    h2 {
      font-size: 18px;
      font-weight: 600;
    }

    .collect {
      width: 20px;
      height: 20px;
      margin-right: 10px;
      background-image: url("~@/assets/images/home/0Yh.png");
      background-repeat: no-repeat;
      background-position: center center;
      background-size: contain;
    }
  }

  iframe {
    width: 100vw;
    height: 100vh;
    margin-top: 44px;
  }

  div {
    width: 100vw;
    height: 100vh;
    line-height: 100vh;
    font-size: 30px;
    font-weight: bolder;
    text-align: center;
  }
}
</style>